// 路由配置表 
import { lazy } from "react"; //路由懒加载
import Home from "../views/Home"; //直接引入组件

import { WapHomeO, ShoppingCartO, FriendsO, GiftO } from '@react-vant/icons';//引入图标


const routes = [
    {
        path: "/home",
        component: Home,
        children:[
            {
                path:"/home/index",
                component:lazy(() => import("../views/home/Index")),
                title:"首页",
                icon:<WapHomeO  />
            },
            {
                path:"/home/classify",
                component:lazy(() => import("../views/home/Classify")),
                title:"分类",
                icon:<GiftO  />
            },
            {
                path:"/home/cart",
                component:lazy(() => import("../views/home/Cart")),
                title:"购物车",
                icon:<ShoppingCartO  />
            },
            {
                path:"/home/my",
                component:lazy(() => import("../views/home/My")),
                title:"我的",
                icon:<FriendsO  />
            },
        ]
    },
    {
        path:"/login",
        component:lazy(()=> import("../views/Login")),
        title:"登录"
    },
    {
        path:"/detail",
        component:lazy(()=> import("../views/Detail")),
        title:"详情"
    },
    // 重定向 
    {
        path:"/",
        redirect: '/home/index',  // 重定向:重新指向其它path,会改变网址
    },

]


// 抛出 
export default routes;